package threeD.Csg.tests;

import inf.v3d.view.Viewer;
import threeD.Csg.Box;
import threeD.Csg.Cylinder;
import threeD.Csg.OctTree;
import threeD.Csg.Sphere;
import twoD.Csg.CsgNode;
import twoD.Csg.CsgNode.Operation;
import twoD.Csg.IPrimitive;

public class OctTreeDemo {

	public void testDraw1() {
		double r = 1;
		IPrimitive S = new Sphere(0, 0, 0, r);
		// IPrimitive B = new Box(-r, -r, -r, 2 * r, 2 * r, r);
		IPrimitive C = new Cylinder(0, 0, -r, r, r);

		CsgNode n1 = new CsgNode();
		CsgNode n2 = new CsgNode();
		n1.setPrimitive(S);
		n2.setPrimitive(C);

		CsgNode n = new CsgNode();
		n.setOperation(Operation.UNION, n1, n2);

		OctTree O = new OctTree(n, -r - 0.5, -r - 0.5, -r - 0.5, 2 * r + 1, 6);
		Viewer v = new Viewer();
		O.draw(v);
		v.setVisible(true);
	}

	public static void main(String[] args) {
		new OctTreeDemo().testDraw1();
	}

}
